<ui:composition
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf"
		>

	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<f:loadBundle basename="bundle.department" var="departmentBundle"/>
		<ui:define name="title">
			<h:outputText value="#{departmentBundle.academicDepartmentList}"/>
		</ui:define>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">
				<ui:define name="content">
					<ui:decorate template="/facelets/template/scrollableTableTemplate.xhtml">
						<ui:param name="actionBean" value="#{academicDepartmentBean}"/>
						<ui:param name="idPrefix" value="academicDepartment"/>
						<ui:define name="editPanelContext">
							<h:panelGrid columns="3">

								<h:outputText value="#{dictionaryBundle.dictionaryCode}"
											  rendered="#{not academicDepartmentBean.record.new}"/>
								<h:outputText value="#{academicDepartmentBean.record.code}"
											  rendered="#{not academicDepartmentBean.record.new}"/>
								<rich:spacer/>

								<h:outputText value="#{departmentBundle.faculty}" styleClass="requiredField"/>
								<itdep:entitySelectMenu value="#{academicDepartmentBean.record.headDepartment}"
														entityType="faculty" format="{i18n.fullName}" required="true"/>
								<rich:spacer/>

								<h:outputText value="#{departmentBundle.fullName}" styleClass="requiredField"/>
								<h:inputText value="#{academicDepartmentBean.record.translations.fullName.value}"
											 id="academicDepartmentFullName" required="true"/>
								<itdep:errorMessage for="academicDepartmentFullName"/>

								<h:outputText value="#{departmentBundle.shortName}" styleClass="requiredField"/>
								<h:inputText value="#{academicDepartmentBean.record.translations.shortName.value}"
											 id="academicDepartmentShortName" required="true"/>
								<itdep:errorMessage for="academicDepartmentShortName"/>

								<h:outputText value="#{departmentBundle.alterName}" styleClass="requiredField"/>
								<h:inputText value="#{academicDepartmentBean.record.translations.alterName.value}"
											 id="academicDepartmentAlterName" required="true"/>
								<itdep:errorMessage for="academicDepartmentAlterName"/>

								<h:outputText value="#{departmentBundle.chief}"/>
								<itdep:entitySelectMenu value="#{academicDepartmentBean.record.chief}"
														entityType="employee" format="{firstName} {lastName}"/>
								<rich:spacer/>

								<h:outputText value="#{departmentBundle.secretary}"/>
								<itdep:entitySelectMenu value="#{academicDepartmentBean.record.secretary}"
														entityType="employee" format="{firstName} {lastName}"/>
								<rich:spacer/>
							</h:panelGrid>
						</ui:define>

						<ui:define name="tableContext">
							<rich:column width="1%">
								<f:facet name="header"><h:outputText value="#{dictionaryBundle.id}"/></f:facet>
								<h:outputText value="#{record.id}"/>
							</rich:column>
							<rich:column width="7%">
								<f:facet name="header"><h:outputText
										value="#{dictionaryBundle.dictionaryCode}"/></f:facet>
								<h:outputText value="#{record.code}"/>
							</rich:column>
							<rich:column width="7%">
								<f:facet name="header"><h:outputText value="#{departmentBundle.faculty}"/></f:facet>
								<itdep:entityOutput value="#{record.headDepartment}" format="{i18n.fullName}"
													locale="#{academicDepartmentBean.translationBean.locale}"/>
							</rich:column>
							<rich:column width="7%">
								<f:facet name="header"><h:outputText
										value="#{departmentBundle.shortName} (#{academicDepartmentBean.translationBean.locale})"/></f:facet>
								<itdep:entityOutput value="#{record}" format="{i18n.shortName}"
													locale="#{academicDepartmentBean.translationBean.locale}"/>
							</rich:column>
							<rich:column width="28%">
								<f:facet name="header"><h:outputText
										value="#{departmentBundle.fullName} (#{academicDepartmentBean.translationBean.locale})"/></f:facet>
								<itdep:entityOutput value="#{record}" format="{i18n.fullName}"
													locale="#{academicDepartmentBean.translationBean.locale}"/>
							</rich:column>
							<rich:column width="15%">
								<f:facet name="header"><h:outputText value="#{departmentBundle.chief}"/></f:facet>
								<itdep:entityOutput value="#{record.chief}" format="{firstName} {lastName}"
													locale="#{academicDepartmentBean.translationBean.locale}"/>
							</rich:column>
							<rich:column width="15%">
								<f:facet name="header"><h:outputText value="#{departmentBundle.secretary}"/></f:facet>
								<itdep:entityOutput value="#{record.secretary}" format="{firstName} {lastName}"
													locale="#{academicDepartmentBean.translationBean.locale}"/>
							</rich:column>
						</ui:define>
					</ui:decorate>
				</ui:define>
			</ui:decorate>
		</ui:define>
	</ui:decorate>

</ui:composition>